package com.smmisia.article.controller;

import com.smmisia.article.dto.request.FollowRequest;
import com.smmisia.article.dto.response.UserResDTO;
import com.smmisia.article.service.FollowService;
import com.smmisia.common.Result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/follow")
@Slf4j
@Tag(name = "关注管理")
public class FollowController {

    @Autowired
    private FollowService followService;

    /**
     * 关注、取消当前用户
     *
     * @param followRequest
     * @return
     */
    @PostMapping("/add")
    @Operation(summary = "关注、取消当前用户")
    public Result<String> follow(@RequestBody FollowRequest followRequest) {
        return followService.follow(followRequest);
    }


    /**
     * 获取我的关注列表
     *
     * @param
     * @return
     */
    @GetMapping("/listFollow")
    @Operation(summary = "获取我的关注列表")
    public Result<List<UserResDTO>> listFollow() {
        return followService.followList();
    }

    /**
     * 获取我的粉丝列表
     *
     * @param
     * @return
     */
    @GetMapping("/listConcern")
    @Operation(summary = "获取我的粉丝列表")
    public Result<List<UserResDTO>> listConcern() {
        return followService.concernList();
    }

    /**
     * 获取朋友
     */
    @GetMapping("/listFriend")
    @Operation(summary = "获取我的朋友")
    public Result<List<UserResDTO>> listFriend() {
        return followService.listFriend();
    }

    /**
     * 判断是否关注
     */
    @GetMapping("/isFollow")
    @Operation(summary = "判断是否关注")
    public Result<Boolean> isFollow(@RequestParam Integer id) {
        return followService.isFollow(id);
    }


}